<template>
  <div>
<!--    询价单分页查询-->
    <el-table
        v-if="identity === 'client'"
        class="table"
        :data="tableData"
        stripe
        style="width: 100%">
      <el-table-column
          prop="address"
          label="选择"
          width="50">
        <template slot-scope="scope">
          <el-radio v-model="radioSelect"
                    :label="scope.row.orderNumber"
                    @change.native="handleRadioChange(scope.row.orderNumber,scope.row.status)"
          >&nbsp;
          </el-radio>
        </template>
      </el-table-column>
      <el-table-column
          prop="orderNumber"
          label="订单号"
          width="150">
        <template slot-scope="scope">
<!--          <router-link :to="{path: '/order/showQuotation', query:{orderNumber:scope.row.orderNumber}}"-->
<!--                       v-text="scope.row.orderNumber"></router-link>>-->
          <a @click="changRoute(scope.row.orderNumber)" v-text="scope.row.orderNumber"></a>
        </template>
      </el-table-column>
      <el-table-column
          prop="createTime"
          label="下单时间"
          width="170">
      </el-table-column>
      <el-table-column
          prop="loading"
          label="计划发车时间"
          width="170">
      </el-table-column>
      <el-table-column
          prop="unload"
          label="计划到达时间"
          width="170">
      </el-table-column>
      <el-table-column
          prop="originPlace"
          label="始发地"
          width="190">
      </el-table-column>
      <el-table-column
          prop="destination"
          label="目的地"
          width="190">
      </el-table-column>
      <el-table-column
          prop="goodsName"
          label="货物"
          width="120">
      </el-table-column>
      <el-table-column
          prop="weights"
          label="重量kg"
          width="100">
      </el-table-column>
      <el-table-column
          prop="quotationOverdue"
          label="报价有效截止日期"
          width="170">
        <template slot-scope="scope">
          <span v-text="scope.row.quotationOverdue === ''? scope.row.quotationOverdue:'---'"></span>
        </template>
      </el-table-column>
      <el-table-column
          prop="status"
          label="状态"
          width="130">
      </el-table-column>


    </el-table>

    <el-table
        v-if="identity === 'carriers'"
        class="table"
        :data="tableData"
        stripe
        style="width: 100%">
      <el-table-column
          prop="address"
          label="选择"
          width="50">
        <template slot-scope="scope">
          <el-radio v-model="radioSelect"
                    :label="scope.row.orderNumber"
                    @change.native="handleRadioChange(scope.row.orderNumber,scope.row.status)"
          >&nbsp;
          </el-radio>
        </template>
      </el-table-column>
      <el-table-column
          prop="orderNumber"
          label="订单号"
          width="120">
       <template scope="scope">
         <a @click="changRoute(scope.row.orderNumber)" v-text="scope.row.orderNumber"></a>
       </template>
      </el-table-column>
      <el-table-column
          prop="companyName"
          label="公司名"
          width="100">
      </el-table-column>
      <el-table-column
          prop="contactName"
          label="联系人"
          width="100">
      </el-table-column>
      <el-table-column
          prop="createTime"
          label="下单时间"
          width="140">
      </el-table-column>
      <el-table-column
          prop="loading"
          label="计划发车时间"
          width="140">
      </el-table-column>
      <el-table-column
          prop="unload"
          label="计划到达时间"
          width="140">
      </el-table-column>
      <el-table-column
          prop="originPlace"
          label="始发地"
          width="110">
      </el-table-column>
      <el-table-column
          prop="destination"
          label="目的地"
          width="110">
      </el-table-column>
      <el-table-column
          prop="goodsName"
          label="货物"
          width="110">
      </el-table-column>
      <el-table-column
          prop="weights"
          label="重量kg"
          width="100">
      </el-table-column>
      <el-table-column
          prop="quotationOverdue"
          label="报价有效截止日期"
          width="140">
      </el-table-column>
      <el-table-column
          prop="inquiryOverdue"
          label="询价有效截止日期"
          width="140">
      </el-table-column>
      <el-table-column
          prop="status"
          label="状态"
          width="100">
      </el-table-column>


    </el-table>
  </div>
</template>

<script>
export default {
  name: "QuotationIndex",
  props:{
    tableData: [],
    identity: String,
  },
  data(){
    return{
      radioSelect: '1',
      status: 0,
    }
  },
  methods:{
    // 跳转
    changRoute(orderNumber){

      if(this.identity === 'client'){
        this.$router.push({name: 'showQuotation', query: {orderNumber: orderNumber,}}).catch(r => console.log(r))
        return;
      }
      this.$router.push({name: 'showQuotation', query: {orderNumber: orderNumber,audit: true}}).catch(r => console.log(r))
    },

    // 选择单选框
    handleRadioChange(number,status) {this.radioSelect = number;this.status = status},
  }
}
</script>

<style scoped lang="scss">

</style>